package com.totoro.service;

import com.totoro.pojo.*;
import net.sf.json.JSONArray;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @author TOTORO
 * @date 2021/7/7 18:25
 */
public interface ProductService {

    Integer addProduct(Product product);

    Integer addProductSkus(Integer pid, JSONArray jsonArray, Integer[] productCounts, double[] productPrices);

    Integer addProductImages(Integer pid, MultipartFile[] files,  HttpServletRequest request);

    Integer updateProductStock(int type, int count, int pid);

    Integer updateSkuGroupStock(int type, int count, int psId);

    Product findProductById(int pid);

    Integer[] findAllProductId();

    Integer findMinSkuIdByPid(int pid);

    Integer findMaxSkuIdByPid(int pid);

    Map<Integer, ProductSpecs> findProductSkuNameById(int pid);

    ProductSpecs findAssignSkuByPidAndSkuId(int skuId);

    Map<Integer, ProductSpecs> findAssignSkusByPidAndSkuData(int pid, String skuData);

    List<ProductImage> findProductImagesById(int pid);

    List<CollectProduct> findAllUserCollectProduct(int uid, String value);

    CollectProduct checkUserCollectProduct(int uid, int pid);

    Integer collectProduct(int uid, int pid);

    Integer cancelCollectProduct(int uid, int pid);

    Integer batchDeleteCollectProduct(Integer[] collectIds);

    Integer updateProductCollectCount(int type, int pid);

    Integer batchReduceProductCollectCount(Integer[] collectIds);

    Integer addBuyShop(BuyShop buyShop);

    BuyShop checkUserBuyShop(BuyShop buyShop);

    Map<Integer, List<BuyShop>> findAllUserBuyShop(int uid, int categoryId, String keyword, int curr);

    List<BuyShop> findAllUserBuyShopList(int uid, int categoryId, String keyword, int curr);

    Integer deleteBuyShop(int uid, int sid);

    Integer addProductCommentCount(int pid);

    List<Product> findProductsByName(String productName, String sort, boolean isDiscount, int curr, double lowPrice, double highPrice, int belongCategoryId);

    Integer findCategoryIdByPid(int pid);

    List<Product> findRecentRandHistoryProducts(int uid);

    List<Product> findHotRandHistoryProducts();

    List<Product> findKeywordAgoProducts();

    List<Product> recommendPidFind(Integer[] productIds);

    List<Product> fuzzyFindProduct(List<String> keywords, int productCount);

    Integer[] getRandShopProduct(int sid, int notPid, int limitCount);

    List<Product> findShopOtherProducts(int sid, int notPid, int limitCount);



    Integer updateProductClickCount(int pid);

    Integer updateCategoryClickCount(int cid);

    Integer updateProductDealCountByPid(int pid);

    Integer updateProductPriceAndStockByPid(Product product);

    Integer updateProductStatusByPid(int pid, boolean isUpdate, int status, boolean isDelete, int deleteStatus);

    Integer updateProductDeleteTime(int pid);

    Integer addProductRecover(int reasonId, int pid);

    List<SearchTextList> findSearchText(String[] texts);

    List<SearchTextList> findReturn(String value);

    Integer addProductMonthDeal(Integer[] integers);

    Integer updateProductMonthDeal(ProductMonthDeal productMonthDeal);

    ProductMonthDeal findNowMonthIsHaveProductDeal(ProductMonthDeal productMonthDeal);
}
